<template>
  <div>



    <el-drawer
      title="搜索"
      :visible.sync="drawersearch"
      :direction="drawersearchdirection"
      :with-header="false"
      size="80%"
    >
      <el-container style="height: 600px">
        <el-header>
          <h3>人员信息筛选</h3>
        </el-header>
        <el-main>
          <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="人员姓名">
              <el-input v-model="form.name" style="width: 100%"></el-input>
            </el-form-item>
<!-- 
            <el-form-item label="人员性别">
              <el-radio-group v-model="form.sex">
                <el-radio label="男" value="男"></el-radio>
                <el-radio label="女" value="女"></el-radio>
              </el-radio-group>
            </el-form-item>


            <el-form-item label="起始日期">
              <el-date-picker
                type="date"
                placeholder="选择日期"
                v-model="form.sdate"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>

            <el-form-item label="终止日期">
              <el-date-picker
                type="date"
                placeholder="选择日期"
                v-model="form.edate"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>

         

            <el-form-item  label="是否转正">
              <el-switch
                v-model="form.isnormal"
                active-text="已转正"
                inactive-text="未转正"
              >
              </el-switch>
            </el-form-item> -->

            <el-form-item>
              <el-button type="primary" @click="usersearch">搜索</el-button>
              <el-button type="danger" @click="onclean">清空</el-button>
            </el-form-item>
          </el-form>
        </el-main>
      </el-container>
    </el-drawer>


  </div>
</template>

<script>
import export2Excel from "../../utils/common";

export default {
  props: ["tableData", "form", "selectdepartment"],

  data() {
    return {
      drawerexport: false,
      drawerexportdirection: "ttb",

      drawersearch: false,
      drawersearchdirection: "rtl",

      tableTitle: [],
      tableRange: [],
      tableid: [],
    };
  },

  methods: {
    async getkeymapname() {
      this.tableid = Object.keys(this.tableData[0]);
      console.log(this.tableid)
      let datas = {
        keyname: this.tableid,
      };
      this.$axios
        .post("api/getkeymapname", datas)
        .then((response) => {
          this.tablename = response.data;
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    exportExcelData() {
      this.getkeymapkey();
    },

    async getkeymapkey() {
      let datas = {
        keyname: this.tableTitle,
      };
      this.$axios
        .post("api/getkeymapkey", datas)
        .then((response) => {
          this.tableid = response.data;
          export2Excel(
            this.tableTitle,
            this.tableid,
            this.tableData,
            "人员信息导出"
          );
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    usersearch() {
      this.$emit("usersearch");
    },

    onclean() {
      this.$emit("onclean");
    },
  },
};
</script>

<style lang="scss" scoped>
</style>